Imports DotNetNuke.Modules.ActiveForums.Settings
Imports System.Web.UI.WebControls


Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class admin_options
        Inherits ActiveAdminBase
#Region "Event Handlers"
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim propImage As String = "<img src=""" & Page.ResolveUrl("~/DesktopModules/ActiveForums/images/properties16.png") & """ alt=""[RESX:ConfigureProperties]"" />"
            rdSubOn.Attributes.Add("onclick", "toggleSub(this);")
            rdSubOn.Attributes.Add("value", "1")
            rdSubOff.Attributes.Add("onclick", "toggleSub(this);")
            rdSubOff.Attributes.Add("value", "0")
            cfgSub.Attributes.Add("style", "display:none;")
            cfgSub.InnerHtml = propImage
            rdAvatarOn.Attributes.Add("onclick", "toggleAvatar(this);")
            rdAvatarOn.Attributes.Add("value", "1")
            rdAvatarOff.Attributes.Add("onclick", "toggleAvatar(this);")
            rdAvatarOff.Attributes.Add("value", "0")
            cfgAvatar.Attributes.Add("style", "display:none;")
            cfgAvatar.InnerHtml = propImage
            rdPointsOn.Attributes.Add("onclick", "togglePoints(this);")
            rdPointsOn.Attributes.Add("value", "1")
            rdPointsOff.Attributes.Add("onclick", "togglePoints(this);")
            rdPointsOff.Attributes.Add("value", "0")
            cfgPoints.Attributes.Add("style", "display:none;")
            cfgPoints.InnerHtml = propImage

            rdUseShortUrlsOn.Attributes.Add("onclick", "toggleURL(this);")
            rdUseShortUrlsOn.Attributes.Add("value", "1")
            rdUseShortUrlsOff.Attributes.Add("onclick", "toggleURL(this);")
            rdUseShortUrlsOff.Attributes.Add("value", "0")
            cfgURLs.Attributes.Add("style", "display:none;")
            cfgURLs.InnerHtml = propImage
            If Not Utilities.IsRewriteLoaded() Or PortalSettings.PortalAlias.HTTPAlias.ToString.Contains("/") Then
                rdUseShortUrlsOff.Enabled = False
                rdUseShortUrlsOn.Enabled = False
            End If
            Dim u As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()

            If u.IsSuperUser And Request.ServerVariables("SERVER_SOFTWARE").Contains("7") And Not PortalSettings.PortalAlias.HTTPAlias.ToString.Contains("/") Then
                If Utilities.IsRewriteLoaded() Then
                    litToggleConfig.Text = "<a href=""javascript:void(0);"" onclick=""amaf_toggleConfig('configdisable',this); return false;"">Uninstall Active Forums URL Handler</a>"
                Else
                    litToggleConfig.Text = "<a href=""javascript:void(0);"" onclick=""amaf_toggleConfig('configenable',this); return false;"">Install Active Forums URL Handler</a>"
                End If

            End If

            'BindTemplateDropDown(drpProfileTemplate, Templates.TemplateTypes.Profile, "[RESX:Default]", "0")
            BindTemplates()
            BindTimeZones()
            BindThemes()
          
            rdFullTextOn.Enabled = True
            rdFullTextOff.Enabled = True
            rdFullTextOff.Checked = True
            rdFullTextOn.Checked = False

            rdMailQueueOn.Enabled = True
            rdMailQueueOff.Enabled = True
            rdMailQueueOff.Checked = True
            rdMailQueueOn.Checked = False


            trSubTypes.Visible = True
            BindSubTypes()
            BindCommOptions()
            BindSettings()

        End Sub

        Private Sub cbAction_Callback(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.CallBackEventArgs) Handles cbAction.Callback
            Dim fullTextAction As Boolean = False
            Dim fullTextPrev As Boolean = False
            Select Case e.Parameters(0).ToString.ToLower
                Case "save"
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.Theme, e.Parameters(1).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ForumTemplateId, e.Parameters(2).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PageSize, e.Parameters(3).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.TemplateCache, e.Parameters(4).ToString)

                    fullTextPrev = MainSettings.FullText
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.FullText, e.Parameters(5).ToString)
                    fullTextAction = CBool(e.Parameters(5).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.DateFormatString, e.Parameters(6).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.TimeFormatString, e.Parameters(7).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.TimeZoneOffset, e.Parameters(8).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.FloodInterval, e.Parameters(9).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.LoggingLevel, e.Parameters(10).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.DeleteBehavior, e.Parameters(11).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.MailQueue, e.Parameters(12).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.EditInterval, e.Parameters(13).ToString)
                    Dim pType As String = e.Parameters(14).ToString
                    Dim pTab As String = "-1"

                    If pType.Contains("|") Then
                        pTab = pType.ToString.Split(CChar("|"))(1)
                        pType = pType.ToString.Split(CChar("|"))(0)
                    End If
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ProfileType, pType)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ProfileTabId, pTab)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowUserPhotos, e.Parameters(15).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowUserBio, e.Parameters(16).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.UserNameDisplay, e.Parameters(17).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.MemberListMode, e.Parameters(18).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowSignatures, e.Parameters(19).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowSubscribe, e.Parameters(20).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowSubTypes, e.Parameters(21).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowAvatars, e.Parameters(22).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AllowAvatarLinks, e.Parameters(23).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AvatarHeight, e.Parameters(24).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AvatarWidth, e.Parameters(25).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.EnablePoints, e.Parameters(26).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.TopicPointValue, e.Parameters(27).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ReplyPointValue, e.Parameters(28).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AnswerPointValue, e.Parameters(29).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.MarkAnswerPointValue, e.Parameters(30).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ModPointValue, e.Parameters(31).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PMType, e.Parameters(32).ToString.Split(CChar("|"))(0))
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PMTabId, e.Parameters(32).ToString.Split(CChar("|"))(1))
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ProfileVisibility, e.Parameters(33).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AddThisAccount, e.Parameters(34).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.AvatarDefault, e.Parameters(35).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.UsersOnlineEnabled, e.Parameters(36).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.UseShortUrls, "True")
                    If Boolean.Parse(e.Parameters(37).ToString) = True And Utilities.IsRewriteLoaded() Then
                        SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.EnableURLRewriter, "True")
                        SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PrefixURLBase, e.Parameters(43).ToString)
                        SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PrefixURLCategories, e.Parameters(44).ToString)
                        SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PrefixURLTags, e.Parameters(45).ToString)
                        SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.PrefixURLOther, e.Parameters(46).ToString)
                    Else
                        SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.EnableURLRewriter, "False")
                    End If
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.RequireCaptcha, e.Parameters(38).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.UseSkinBreadCrumb, e.Parameters(39).ToString)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.EnableAutoLink, e.Parameters(40).ToString)
                    Dim topicKey As String = e.Parameters(41).ToString
                    If Not String.IsNullOrEmpty(topicKey) Then
                        Try
                            topicKey = topicKey.Trim
                            Dim gpparse As Guid = New Guid(topicKey)
                        Catch ex As Exception
                            topicKey = String.Empty
                        End Try
                    End If
                    Dim replyKey As String = e.Parameters(42).ToString
                    If Not String.IsNullOrEmpty(replyKey) Then
                        Try
                            replyKey = replyKey.Trim
                            Dim gpparse As Guid = New Guid(replyKey)
                        Catch ex As Exception
                            replyKey = String.Empty
                        End Try
                    End If
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ActiveSocialTopicKey, topicKey)
                    SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.ActiveSocialRepliesKey, replyKey)
                Case "configenable"
                    Dim cfg As New ConfigUtils
                    Dim success As Boolean = cfg.EnableRewriter(Server.MapPath("~/web.config"))
                Case "configdisable"
                    Dim cfg As New ConfigUtils
                    Dim success As Boolean = cfg.DisableRewriter(Server.MapPath("~/web.config"))


            End Select

            Try
                If fullTextAction = True And fullTextPrev = False Then
                    DataProvider.Instance.Search_ManageFullText(fullTextAction)
                    Dim err As String = String.Empty
                    Dim s As String = Utilities.GetSqlString("FullText.sql")
                    err = DotNetNuke.Data.DataProvider.Instance().ExecuteScript(s)
                ElseIf fullTextAction = False And fullTextPrev = True Then
                    DataProvider.Instance.Search_ManageFullText(fullTextAction)
                End If
            Catch ex As Exception
                SaveSetting(ModuleId, SettingKeys.GeneralSettingsKey, SettingKeys.FullText, "false")
                DotNetNuke.Services.Exceptions.ProcessModuleLoadException(Me, ex)
            End Try

            'DataCache.CacheClear()
            DataCache.ClearAllCache(ModuleId, TabId)

        End Sub
#End Region

#Region "Private Methods"
        Private Sub BindSettings()
            drpThemes.SelectedIndex = drpThemes.Items.IndexOf(drpThemes.Items.FindByValue(MainSettings.Theme))
            drpTemplates.SelectedIndex = drpTemplates.Items.IndexOf(drpTemplates.Items.FindByValue(CStr(MainSettings.ForumTemplateID)))
            numPageSize.Text = MainSettings.PageSize
            numFlood.Text = MainSettings.FloodInterval
            numEdit.Text = MainSettings.EditInterval


            'drpCacheLocation.SelectedIndex = drpCacheLocation.Items.IndexOf(drpCacheLocation.Items.FindByValue(CStr(MainSettings.TemplateCache)))

            drpDateFormat.SelectedIndex = drpDateFormat.Items.IndexOf(drpDateFormat.Items.FindByValue(MainSettings.DateFormatString))
            drpTimeFormat.SelectedIndex = drpTimeFormat.Items.IndexOf(drpTimeFormat.Items.FindByValue(MainSettings.TimeFormatString))

            rdMailQueueOn.Checked = MainSettings.MailQueue
            rdMailQueueOff.Checked = CBool(IIf(MainSettings.MailQueue, False, True))
            rdFullTextOn.Checked = MainSettings.FullText
            rdFullTextOff.Checked = CBool(IIf(MainSettings.FullText, False, True))

            drpDeleteBehavior.SelectedIndex = drpDeleteBehavior.Items.IndexOf(drpDeleteBehavior.Items.FindByValue(CStr(MainSettings.DeleteBehavior)))
            'drpLoggingLevel.SelectedIndex = drpLoggingLevel.Items.IndexOf(drpLoggingLevel.Items.FindByValue(CStr(MainSettings.LoggingLevel)))
            Dim pType As Integer = MainSettings.ProfileType
            Dim pKey As String = pType.ToString

            'If MainSettings.ProfileTabId > -1 Then
            '    pKey = pKey & "|" & MainSettings.ProfileTabId.ToString
            'End If

            drpProfileType.SelectedIndex = drpProfileType.Items.IndexOf(drpProfileType.Items.FindByValue(pKey))

            Dim pmKey As String = MainSettings.PMType & "|" & MainSettings.PMTabId
            drpPrivateMessaging.SelectedIndex = drpPrivateMessaging.Items.IndexOf(drpPrivateMessaging.Items.FindByValue(pmKey))

            drpUserDisplayMode.SelectedIndex = drpUserDisplayMode.Items.IndexOf(drpUserDisplayMode.Items.FindByValue(MainSettings.UserNameDisplay))
            drpProfileVisibility.SelectedIndex = drpProfileVisibility.Items.IndexOf(drpProfileVisibility.Items.FindByValue(MainSettings.ProfileVisibility))
            drpSignatures.SelectedIndex = drpSignatures.Items.IndexOf(drpSignatures.Items.FindByValue(CStr(MainSettings.AllowSignatures)))
            'If MainSettings.AllowSubscribe Then
            '    rdSubOn.Checked = True
            '    rdSubOff.Checked = False
            '    cfgSub.Attributes.Remove("style")
            'Else
            '    rdSubOn.Checked = False
            '    rdSubOff.Checked = True
            '    cfgSub.Attributes.Add("style", "display:none;")
            'End If
            cfgSub.Attributes.Add("onclick", "showProp(this,'subProp')")
            'chkEnableSubscriptions.Checked = MainSettings.AllowSubscribe
            'If ProductSku.Contains("ENTERPRISE") Then
            Dim subType As String
            For Each subType In MainSettings.AllowSubTypes.Split(New Char() {":"c})
                Dim item As ListItem
                For Each item In chkSubTypes.Items
                    If item.Value = subType Then
                        item.Selected = True
                    End If
                Next item
            Next
            'End If
            If MainSettings.UsersOnlineEnabled Then
                rdWhosOnlineOn.Checked = True
                rdWhosOnlineOff.Checked = False
            Else
                rdWhosOnlineOn.Checked = False
                rdWhosOnlineOff.Checked = True
            End If
            If MainSettings.AutoLinkEnabled Then
                rdAutoLinkOn.Checked = True
                rdAutoLinkOff.Checked = False
            Else
                rdAutoLinkOn.Checked = False
                rdAutoLinkOff.Checked = True
            End If
            If MainSettings.UseShortUrls Then
                rdUseShortUrlsOn.Checked = True
                rdUseShortUrlsOff.Checked = False
            Else
                rdUseShortUrlsOn.Checked = False
                rdUseShortUrlsOff.Checked = True
            End If
            'If MainSettings.RequireCaptcha Then
            '    rdCaptchaOn.Checked = True
            '    rdCaptchaOff.Checked = False
            'Else
            '    rdCaptchaOn.Checked = False
            '    rdCaptchaOff.Checked = True
            'End If
            If MainSettings.UseSkinBreadCrumb Then
                rdSkinBreadOn.Checked = True
                rdSkinBreadOff.Checked = False
            Else
                rdSkinBreadOn.Checked = False
                rdSkinBreadOff.Checked = True
            End If
            'If MainSettings.AllowAvatars Then
            '    rdAvatarOn.Checked = True
            '    rdAvatarOff.Checked = False
            '    cfgAvatar.Attributes.Remove("style")
            'Else
            '    rdAvatarOn.Checked = False
            '    rdAvatarOff.Checked = True
            '    cfgAvatar.Attributes.Add("style", "display:none;")
            'End If
            'cfgAvatar.Attributes.Add("onclick", "showProp(this,'avatarProp')")
            'chkEnableAvatarLinks.Checked = MainSettings.AllowAvatarLinks
            'txtAvatarHeight.Text = MainSettings.AvatarHeight.ToString
            'txtAvatarWidth.Text = MainSettings.AvatarWidth.ToString
            'chkEnableDefaultAvatar.Checked = MainSettings.AvatarDefault
            If MainSettings.EnablePoints Then
                rdPointsOn.Checked = True
                rdPointsOff.Checked = False
                cfgPoints.Attributes.Remove("style")
            Else
                rdPointsOn.Checked = False
                rdPointsOff.Checked = True
                cfgPoints.Attributes.Add("style", "display:none;")
            End If
            cfgPoints.Attributes.Add("onclick", "showProp(this,'pointsProp')")
            txtTopicPointValue.Text = MainSettings.TopicPointValue.ToString
            txtReplyPointValue.Text = MainSettings.ReplyPointValue.ToString
            txtAnswerPointValue.Text = MainSettings.AnswerPointValue.ToString
            txtMarkAnswerPointValue.Text = MainSettings.MarkAsAnswerPointValue.ToString
            txtModPointValue.Text = MainSettings.ModPointValue.ToString
            txtAddThis.Text = MainSettings.AddThisAccount.ToString

           
            txtURLPrefixBase.Text = MainSettings.PrefixURLBase
            txtURLPrefixCategory.Text = MainSettings.PrefixURLCategory
            txtURLPrefixTags.Text = MainSettings.PrefixURLTag
            txtURLPrefixOther.Text = MainSettings.PrefixURLOther
            txtURLPrefixCategory.Enabled = False
            txtURLPrefixTags.Enabled = False
            If MainSettings.URLRewriteEnabled And Utilities.IsRewriteLoaded() Then
                rdUseShortUrlsOn.Checked = True
                rdUseShortUrlsOff.Checked = False
                cfgURLs.Attributes.Remove("style")
            Else
                rdUseShortUrlsOn.Checked = False
                rdUseShortUrlsOff.Checked = True
                cfgURLs.Attributes.Add("style", "display:none;")
                txtURLPrefixBase.Text = "forums"
                txtURLPrefixCategory.Text = "category"
                txtURLPrefixTags.Text = "tag"
                txtURLPrefixOther.Text = "view"
            End If
            cfgURLs.Attributes.Add("onclick", "showProp(this,'propURLS')")




        End Sub
        Private Sub BindSubTypes()
            chkSubTypes.Items.Insert(0, New ListItem([Enum].GetName(GetType(SubscriptionTypes), 0), CStr(SubscriptionTypes.Disabled)))
            chkSubTypes.Items.Insert(1, New ListItem([Enum].GetName(GetType(SubscriptionTypes), 1), CStr(SubscriptionTypes.Instant)))
            'chkSubTypes.Items.Insert(2, New ListItem([Enum].GetName(GetType(SubscriptionTypes), 2), CStr(SubscriptionTypes.DailyDigest)))
            'chkSubTypes.Items.Insert(3, New ListItem([Enum].GetName(GetType(SubscriptionTypes), 3), CStr(SubscriptionTypes.WeeklyDigest)))
        End Sub
        Private Sub BindTimeZones()
            'DotNetNuke.Services.Localization.Localization.LoadTimeZoneDropDownList(drpServerTimeZone, CType(Page, DotNetNuke.Framework.PageBase).PageCulture.Name, Convert.ToString(PortalSettings.TimeZoneOffset))
        End Sub
        Private Sub BindTemplates()
            Dim tc As New TemplateController
            Dim tl As New List(Of TemplateInfo)
            tl = tc.Template_List(PortalId, ModuleId, Templates.TemplateTypes.ForumView)
            drpTemplates.DataTextField = "Title"
            drpTemplates.DataValueField = "TemplateId"
            drpTemplates.DataSource = tl
            drpTemplates.DataBind()
            drpTemplates.Items.Insert(0, New ListItem("Default", "0"))
        End Sub
        Private Sub BindThemes()
            Dim di As New IO.DirectoryInfo(Server.MapPath("~/DesktopModules/ActiveForums/themes"))
            drpThemes.DataSource = di.GetDirectories()
            drpThemes.DataBind()
        End Sub
        Private Sub BindCommOptions()
            drpPrivateMessaging.Items.Insert(0, New ListItem(GetSharedResource("[RESX:DefaultDisabled]"), "0|-1"))
            drpProfileType.Items.Insert(0, New ListItem(GetSharedResource("[RESX:DefaultDisabled]"), "0"))
            drpProfileType.Items.Insert(1, New ListItem(GetSharedResource("[RESX:ProfileBasic]"), "1"))
            Dim mc As New DotNetNuke.Entities.Modules.ModuleController
            Dim tc As New DotNetNuke.Entities.Tabs.TabController
            Dim ti As DotNetNuke.Entities.Tabs.TabInfo = Nothing
            For Each mi As DotNetNuke.Entities.Modules.ModuleInfo In mc.GetModules(PortalId)
               


                If mi.ModuleName.Contains("Active Social") And mi.IsDeleted = False Then
                    ti = tc.GetTab(mi.TabID, PortalId, False)
                    If Not ti Is Nothing Then
                        If ti.IsDeleted = False Then
                            drpProfileType.Items.Add(New ListItem(ti.TabName & " - Active Social", "3|" & mi.TabID.ToString))
                            drpPrivateMessaging.Items.Add(New ListItem(ti.TabName & " - Active Social", "3|" & mi.TabID.ToString))
                        End If
                    End If
                End If
                If mi.ModuleName.Contains("DotNetNuke.Modules.CoreMessaging") And mi.IsDeleted = False Then
                    ti = tc.GetTab(mi.TabID, PortalId, False)
                    If Not ti Is Nothing Then
                        If ti.IsDeleted = False Then
                            drpPrivateMessaging.Items.Add(New ListItem(ti.TabName & " - " & mi.ModuleName, "2|" & mi.TabID.ToString))
                        End If
                    End If
                End If
                '
                If mi.ModuleName.Contains("DnnForge - PrivateMessages") And mi.IsDeleted = False Then
                    ti = tc.GetTab(mi.TabID, PortalId, False)
                    If Not ti Is Nothing Then
                        If ti.IsDeleted = False Then
                            drpPrivateMessaging.Items.Add(New ListItem(ti.TabName & " - " & mi.ModuleName, "2|" & mi.TabID.ToString))
                        End If
                    End If

                End If
            Next
        End Sub


#End Region

    End Class
End Namespace